1. Field of the Invention
The present invention relates generally to an automated tool for debugging a set of source code. More particularly, the present invention relates to a tool for debugging networking software using a test script.
2. Description of the Related Art
In a network, a number of computers are connected by transmission lines and switching elements. These switching elements are specialized computers used to connect two or more transmission lines and provide a mechanism for selecting one of the transmission lines each time a packet is transmitted. Common examples of switching elements are xe2x80x9croutersxe2x80x9d and xe2x80x9cbridgesxe2x80x9d. Accordingly, the terms xe2x80x9cswitching elementxe2x80x9d and xe2x80x9crouterxe2x80x9d are hereinafter used interchangeably.
Each router includes an operating system, or networking software. In order to verify that the router is functioning properly, the networking software must be adequately tested. Typically, this testing is a manual process during which a set of test commands are entered by a test engineer. During a test session, a log file is often recorded which includes the set of test commands and associated outputs. Searching the log file for error messages is traditionally performed manually. A log file may contain thousands of lines and searching through the log file for error messages can be a tedious process. Moreover, once pertinent commands are obtained from these log files, these commands must be manually reentered to recreate the testing scenario. Accordingly, the debugging of source code can be a time-consuming and cumbersome task.
Various debugging products are available for debugging source code written in various languages (e.g., C, C++). Using these debugging products, the values of various variables may be traced and lines of code may be stepped through to assist in debugging this source code. Such debugging tools commonly accept a program, or xe2x80x9csource codexe2x80x9d, as input and execute it at the user""s desired pace, displaying the source code commands that were executed and outputs resulting from these executed commands (e.g., debug information and program output).
Although debugging tools typically accept the program to be debugged as input, debugging tools traditionally do not accept a log file as input for further testing of the source code that originated the log file or other source code. Moreover, debugging tools traditionally provide a set of debugging commands used to step through a portion of source code in order to debug the source code. However, such debugging tools have not been used to step through a test script or log file associated with a test script in order to test a separate set of source code such as networking software.
During testing of networking software, it is often necessary to test multiple code versions of the networking software, retest the networking software, or test different networking software which are likely to contain similar problems. In addition, since such errors may be due to hardware as well as software problems, it may be desirable to run the networking software on different test beds to ascertain the source of the problem. By way of example, if a test fails on two similar test beds, it can be inferred that the source of the problem is hardware related.
One of the most crucial aspects of the debugging process performed by an engineer is the creation of an error report. Without such a report, it would be impossible to track exactly which tests were performed and which of these tests failed. Moreover, it is imperative that the source code (e.g., version), configuration information, and hardware on which the source code is tested be carefully documented so that the test results may be reproduced at a later date. Typically, once testing is completed, the engineer performing the testing will prepare an error report documenting the test session. However, manual entry of such information is a time-consuming process. Therefore, it would be desirable if an error report could be generated automatically with little or no input from the engineer performing the testing.
In view of the above, it would be beneficial if an automated debugging tool were provided which would allow an engineer to recreate test situations to aid in ascertaining the cause of failure while testing a set of source code (e.g., networking software). In addition, it would be desirable if selected test commands obtained from a test script or associated log file could be rerun on the set of source code, or alternatively, used to test other sets of source code. Moreover, it would be beneficial if relevant commands that would aid in the debugging process could be provided.
The present invention provides a method and apparatus for debugging source code. This is accomplished through providing a set of debug commands designed to apply a set of test commands to the source code. The set of test commands may be obtained directly from a test script or from a log file created after executing the test script on a test bed running the source code to be debugged.
A method and tool for debugging a set of source code is disclosed. The source code may include communication software adapted for enabling communication between a set of devices. By way of example, the communication software may include networking software installed on a router. A plurality of test commands for testing the source code are obtained. The plurality of test commands may be obtained from a test script or a log file which contain the exact sequence of test commands needed to recreate the particular test scenario. For example, if the test script cannot be sequentially executed, a log file associated with the test script may be used.
A set of debugging commands for executing a set of the plurality of test commands is provided. The set of debugging commands include device commands and commands designed to assist in the debugging process. The device commands are designed to execute one or more commands on the test bed (e.g., device) running the source code. Device commands may include new test commands as well as commands designed to execute a set of the plurality of test commands. In contrast, the debug commands designed to assist in the debugging process provide information to assist in the debugging process, and are not run on the source code.
The source code is then debugged using the set of debugging commands. Through the debugging commands, selected ones of the plurality of test commands and new commands entered by a user may be executed on the source code. Output is obtained from the source code. This output may then be displayed. Moreover, the output associated with the execution of test commands may be logged in a log file or error report.
The advantages of the present invention are numerous. The present invention may be used to test source code such as networking software in a more efficient manner than traditional methods. Similarly, the present invention provides considerable time saving advantages while testing multiple versions of source code. In addition, the debugging tool may be used with various platforms, or test beds, to identify the source of a problem (e.g., hardware or software). Moreover, the present invention may be used to automatically generate an error report and other log files corresponding to a test session. In this manner, the time required to test source code may be substantially decreased. As a result, the production costs associated with testing source code may be significantly reduced.